package com.ld.poetry.controller;

import com.ld.poetry.config.LoginCheck;
import com.ld.poetry.config.PoetryResult;
import com.ld.poetry.entity.ResourceConfig;
import com.ld.poetry.service.ResourceConfigService;
import com.ld.poetry.vo.ResourceConfigUpdateVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 资源配置控制器
 */
@RestController
@RequestMapping("/resource-config")
public class ResourceConfigController {

    @Resource
    private ResourceConfigService resourceConfigService;

    @LoginCheck(0)
    @GetMapping("/select-all")
    public PoetryResult<List<ResourceConfig>> selectAll(){
        return PoetryResult.success(resourceConfigService.list());
    }

    @LoginCheck(0)
    @PostMapping("/update-select-config")
    public synchronized PoetryResult<Object> updateSelectConfig(@RequestBody ResourceConfigUpdateVO updateVO){
       resourceConfigService.updateSelectConfig(updateVO);

        return PoetryResult.success();
    }
}

